import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:gczn_hd/app/core/base/base_controller.dart';
import 'package:get/get.dart';

class SpotcheckController extends BaseController with GetSingleTickerProviderStateMixin {

  TabController? tabController;
  final List<String> tabListString = ["点检计划", "点检记录"];


  RxList<String> seleces = [
    "全部",
    "PDF",
    "XML",
    "IMAGE",
  ].obs;
  RxString selectLine = "全部".obs;
  RxString selectStation = "全部".obs;
  RxString selectMachine = "全部".obs;

  Rx<EasyRefreshController> gcznPlanController = EasyRefreshController(
    controlFinishRefresh: true,
    controlFinishLoad: false,
  ).obs;

  Rx<EasyRefreshController> gcznLogController = EasyRefreshController(
    controlFinishRefresh: true,
    controlFinishLoad: false,
  ).obs;


  onViewInit(){
    tabController = TabController(length: tabListString.length, vsync: this);

  }


  onRefresh() async {
    await Future.delayed(const Duration(seconds: 2));
    gcznPlanController.value.finishRefresh();
    gcznPlanController.value.resetFooter();
  }

  onLoadNextPage() async {
    await Future.delayed(const Duration(seconds: 2));
    gcznPlanController.value.finishLoad(IndicatorResult.noMore, true);
  }

  @override
  void onClose() {
    gcznPlanController.value.dispose();
    gcznLogController.value.dispose();
    tabController?.dispose();
    super.onClose();
  }

}
